﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Program06
{
    class FullReduction
    {
        #region 需求
        //有些商品是单价打折
        //有些是总价满减
        //有些是第二个半价
        //……
        #endregion

        private Sale Sale { get; set; }
        //上限
        private double _upperLimit;
        public double Upperlimit
        {
            get { return _upperLimit; }
            set { _upperLimit = value < 0 ? 0 : value; }
        }
        //减价
        private double _fullPice;
        public double FullPrice
        {
            get { return _fullPice; }
            set { _fullPice = value < 0 ? 0 : value; }
        }

        public FullReduction() { }
        public FullReduction(Sale sale)
        {
            this.Sale = sale;
        }

        /// <summary>
        /// 传入一个商品的单价，计算总价满减
        /// </summary>
        /// <param name="price"></param>
        public void Full(double price)
        {
            Sale = new Sale(price) { Count = Sale.Count };
            if (Sale.Total > Upperlimit)
            {
                Console.WriteLine("总价：{0}",Sale.Total - FullPrice);
            }
        }
    }
}
